package test;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;

/**
 * @author 小石潭记
 * @date 2021/7/27 14:22
 * @Description: ${todo}
 */
public class compare {

    public static void main(String[] arg) {
        User user1 = new User(1, BigDecimal.valueOf(100), "张三");
        User user2 = new User(2, BigDecimal.valueOf(0), "李四");
        User user3 = new User(3, BigDecimal.valueOf(-1), "王五");
        List<User> list = new ArrayList<>();
        list.add(user1);
        list.add(user2);
        list.add(user3);
        list.stream().filter(item -> BigDecimal.ZERO.compareTo(item.getBalance()) < 0)
                .forEach(item -> System.out.println(item));
    }

    @Data
    @AllArgsConstructor
    @NoArgsConstructor
    public static class User {
        private int id;
        private BigDecimal balance;
        private String name;
    }
}
